<template>
  <div>
    <el-row :gutter="15">
      <el-form ref="form" :model="form" size="medium" label-width="100px" v-bind:disabled="isEditing">
        <el-col :span="24">
          <el-form-item label="车牌号">
            <el-input v-model="form.carsMsg.licenseNumber" placeholder="请输入车牌号" show-word-limit clearable
                      :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="订单编号" prop="poid">
            <el-input v-model="form.poid" placeholder="请输入订单编号" show-word-limit clearable
                      :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="订单金额" prop="payOrder.orderPrice">
            <el-input v-model="form.payOrder.orderPrice" placeholder="请输入订单金额" show-word-limit clearable
                      :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="支付方式" prop="ptid" selected>
            <el-select v-model="form.ptid" placeholder="请选择支付方式" clearable :style="{width: '100%'}">
              <el-option
                v-for="item in payType"
                :key="item.ptid"
                :label="item.typeName"
                :value="item.ptid">
              </el-option>,
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="订单类型" prop="uuid" >
            <el-select v-model="form.uuid" placeholder="请选择订单类型" clearable :style="{width: '100%'}">
              <el-option v-for="item in ctidOptions" :key="item.value" :label="item.label"
                         :value="item.value" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="订单状态">
            <el-select v-model="form.payOrder.orderStatus" placeholder="请选择订单状态" clearable :style="{width: '100%'}">
              <el-option v-for="(item, index) in ptidOptions" :key="index" :label="item.label"
                         :value="item.value" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="放行原因" prop="permit">
            <el-input v-model="form.permit" placeholder="请输入放行原因" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="入场时间" prop="create_time">
            <el-input v-model="form.create_time" placeholder="入场时间" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="出场时间" prop="update_time">
            <el-input v-model="form.update_time" placeholder="出场时间" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="入场照片" prop="field119">
            <el-input v-model="form.field119" placeholder="入场照片" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="出场照片" prop="field120">
            <el-input v-model="form.field120" placeholder="出场照片" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24" style="text-align:center">
          <el-button type="primary" @click="submitForm">修改</el-button>
          <el-button @click="cancel" :disabled="false">返回</el-button>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>
<script>
import {getptApiList} from "@/api/pxy-report/paytype";
import {updatePark} from "@/api/pxy-report/park";
import path from "path";

export default {
  name: "Park",
  components: {},
  props: [],
  data() {
    return {
      payType:[],
      isEditing: false,
      form: {
        carsMsg: {licenseNumber: ''},
        poid: '',
        payOrder: {
          orderPrice: '',
          orderStatus:''},
        ptid: '',
        ctid: '',
        uuid: '',
        permit: '',
        create_time: '',
        update_time: '',
        field119: '',
        field120: '',
      },
      ctidOptions: [{
        "label": "普通订单",
        "value": 0
      }, {
        "label": "追缴订单",
        "value": 1
      }],
      ptidOptions: [{
        "label": "未支付",
        "value": 0
      }, {
        "label": "已支付",
        "value": 1
      }],
    }
  },
  computed: {},
  watch: {},
  created() {
    this.form = this.$route.query.form
    this.form.uuid=parseInt(this.$route.query.form.uuid)
    this.form.ptid=parseInt(this.$route.query.form.ptid)

    const isEditing = this.$route.query.isEditing;
    // this.isEditing= JSON.parse(this.isEditing).booleanValue
    // this.isEditing = !!users
    this.isEditing = isEditing

    console.log(isEditing)
    this.getPayType();
  },
  mounted() {

  },
  methods: {
    getPayType() {
      this.loading = true;
      getptApiList(this.queryParams).then(response => {
        this.payType = response.rows;
        console.log(this.payType)
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.$store.dispatch('tagsView/delAllViews', this.$router);
      this.$router.push('park')
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          updatePark(this.form).then(response => {
            this.$modal.msgSuccess("修改成功");
            this.open = false;
            this.getList();
          });
        }
      });
    },
  }
}

</script>
<style>
</style>
